package demo;

public class HeHe {
	public String xiangJia(String a,String b){
		if(a==null||b==null){
			throw new IllegalArgumentException("字符串参数不能为空");
		}
		String s=new String();
		s=a+b;
		return s;//字符串相加
	}
	public int chang(String s){
		if(s==null){
			throw new IllegalArgumentException("字符串参数不能为空");
		}
		return s.length();//字符串长度
	}
	public String tiHuan(String s,String a,String b){//字符串替换
		if(s==null||a==null||b==null){
			throw new IllegalArgumentException("字符串参数不能为空");
		}
		else if(s.indexOf(a)==-1){
			throw new IllegalArgumentException("字符串a必须是s的子串");
		}
		s.replace(a,b);
		return s;
	}
}
